package com.lou1052.data.query.page;

/**
 * 分页结果转换
 * Created with IntelliJ IDEA.
 * User: liuqing
 * Date: 2016/1/16
 * Time: 13:17
 * To change this template use File | Settings | File Templates.
 */
public final class PageConverterUtil {
    private PageConverterUtil(){}

    public  static <E> PageResult<E> fromSpringDataPage(org.springframework.data.domain.Page<E> page,IPageR pageQuery){
        PageResult<E> pageResult = new PageResult<>(pageQuery.getPageNum(),pageQuery.getPageSize(),page.getTotalPages(),page.getNumberOfElements(),page.getTotalElements(),pageQuery.getNavigatePages(),page.getContent());
        return  pageResult;
    }
}
